Design and implementation of a low-level language for interaction nets

نویسنده

  • Shinya Sato
چکیده

machine of AMINE Here, we review the definition of the abstract machine formally: 42 Definition 3.3.2 (Notations for maps) • We use [ ] as an empty map. • Let ψ be a map. We use the following notation: ψ[x 7→ a](z) def =  a (z is x) ψ(z) (otherwise). When ψ(x) is undefined, we use the following notation: ψ[x 7→ ⊥](z) def =  undefined (z = x) ψ(z) (otherwise). We may also write ψ(x) = ⊥ when ψ(x) is undefined. Definition 3.3.3 (Connection maps) • We define a heap E as a map from a name into an annotated term. • We define a connection map P as a map between names having the following property: if P(x) = y then P(y) = x. We use the following notation: P[x↔ y](z) def =  y (z is x) x (z is y) P(z) (otherwise). When P(x) is undefined, we use the following notation: P[x↔ ⊥](z) def =  undefined (z = x) P(z) (otherwise). – We write P1P2 as the union map of P1 and P2 where a given argument is applied to P2 before P1. – We write Pr as the result of replacing each occurrence of a name x for the domain and range of P with conserving their relationship by a fresh name xr respectively. Definition 3.3.4 (Interaction operation) • Interaction rules in the abstract machine have the form: (α(~s), β(~u), P). We require that there exists at most one rule for the same active pair, and each rule is closed under symmetry, thus if (t, s, P) exists then (s, t, P) also exists. In addition, we also require that there is no name which occurs in both ~s and ~u. 43 • We use Rm as a set of interaction rules in the abstract machine. To write a rule corresponding to r ∈ R, we need to split each linear name x in r into fresh names x1 and x2 respectively and store their linking information as P[x1 ↔ x2]. We denote a rule in the abstract machine for r ∈ R as Compile(r), and a rule set for R as Compile(R). • We define the interaction operations in the abstract machine as follows: Interaction(α(~ s1), β( ~ u1)) def =  (Ann((~ s1, ~ sr), ( ~ u1, ~ ur)), P r) (when (α(~s), β(~u), P) ∈ Rm) (−, [ ]) (otherwise) where ~ sr, ~ ur, Pr are the result of replacing each occurrence of a name x for ~s, ~u and P, conserving their original relationship respectively. Error((( ~ xa).α(~s), ( ~ ya).β(~u))) def =  − (when (α(~s), β(~u), P) ∈ Rm) (( ~ xa).α(~s), ( ~ ya).β(~u)) (otherwise) Definition 3.3.5 (Machine configuration) We define a configuration of the abstract machine state as a tuple having the following form: ( E | P | S | V | Cy | op ), where • E is a heap, • P is a connection map, • S is a sequence of annotated terms pairs representing equations, • V is a sequence of annotated terms representing an interface, • Cy is a sequence of annotated terms pairs representing a sequence of cycles, and pairs for which there is no interaction rule, and • op is an instruction of this machine defined as follows: Instruction Description process(ta, ua) process the pair (ta, ua), delist pop a pair from S to be processed, enlist((~ ta, ~ ua)) push pairs (~ ta, ~ ua) onto S, cycle(x, ta) push a cycle pair (x, ta) to Cy. 44 The abstract machine is loaded with op = delist, and stops when S is the empty sequence and op is delist. In Figure 3.1 and 3.2 we give the semantics of the machine as a set of transition rules of the form: ( E | P | S | V | Cy | op ) =⇒ ( E′ | P′ | S′ | V ′ | C ′ y | op′ ). For readability purposes, we present the transitions in a table format. For example, the entry: Before After II.2 Heap E [z 7→ ta] E Connection P [x↔ z] P op process(x, y) process(ta, y) corresponds to: ( E[z 7→ ta] | P[x↔ z] | S | V | Cy | process(x, y) ) =⇒ ( E | P | S | V | Cy | process(ta, y) ). Before After I Connection P PP′ Cycles Cy ~ pa, Cy op process(( ~ xa).α(~s), ( ~ ya).β(~u)) enlist(~ qa) where Error(( ~ xa).α(~s), ( ~ ya).β(~u)) = ~ pa, Interaction(α(~s), β(~u)) = (~ qa, P ′). II.1 Connection P [x↔ y] P [x↔ y] op process(x, y) cycle(x, y) II.2 Heap E [z 7→ ( ~ xa).α(~t)] E Connection P [x↔ z] P op process(x, y) process(( ~ xa).α(~t), y) II.3 Heap E [z 7→ ⊥] [w 7→ ( ~ xa).t] E Connection P [x↔ z] [y ↔ w] P [x↔ z] op process(x, y) process(x, ( ~ xa).t) II.4 Heap E [z 7→ ⊥] [w 7→ ⊥] E Connection P [x↔ z] [y ↔ w] P [z ↔ w] op process(x, y) delist Figure 3.1: Transitions for codes process(( ~ xa).α(~s), ( ~ ya).β(~u)) and process(x, y) 45 Before After III.0 op process(( ~ xa).t, y) process(y, ( ~ xa).t) III.1 Heap E [x 7→ (~x, ).t] E Connection P [x↔ y] P op process(z, (y, ~ ya).s) process(z, (~x, ~ ya).s[t/y]) III.2 Heap E [x 7→ ⊥] E Connection P [x↔ y] P [x↔ y] op process(z, (y, ~ ya).s) process(z, ( ~ ya,y).s) III.3 Connection P [x↔ y] P [x↔ y] op process(x, (y, ~ ya).s) cycle(x, (y, ~ ya).s) III.4 Heap E [x 7→ ( ~ xa).t] E Connection P [x↔ z] P op process(z, ( , ~ ya).s) process(( ~ xa).t, ( , ~ ya).s) III.5 Heap E [x 7→ ⊥] E [z 7→ ( ~ ya, ).s] Connection P [x↔ z] P [x↔ z] op process(z, ( , ~ ya).s) delist T.1 Pairs (ta, ua), S S op delist process(ta, ua) T.2 Pairs S (ta, ua), S op enlist((ta, ua), ~ p) enlist(~ p) T.3 op enlist(−) delist T.4 Cycles Cy (ta, ua), Cy op cycle(ta, ua) delist Figure 3.2: Transitions for other codes Definition 3.3.6 (Initial loading) • We define a translation Compile() from a configuration of interaction nets into a configuration of the abstract machine state as follows: Compile(〈 ~t | ∆ 〉) def = ( [ ] | P′ | Ann(∆′) | Ann(~t′) | − | delist ) where ~t′ and ∆′ are the result of splitting each occurrence of a linear name x in ~t and ∆ into fresh names x1 and x2 respectively, and P ′ is the result of storing their linking information [x1 ↔ x2]. We can obtain the computation result by using the following operation: 46 Definition 3.3.7 (Updating operation) • We define a function remAnn : T ∪ Ta → T to obtain a term without annotation as follows:  remAnn(x) def = x, remAnn(α(t1, . . . , tn)) def = α(remAnn(t1), . . . , remAnn(tn)), remAnn(( ~ xa).t) def = remAnn(t). We extend this function into sequences as follows: remAnn(t1, . . . , tn) def = remAnn(t1), . . . , remAnn(tn). • We define the updating operation for distributed information Update as follows: Update( E | P | S | V | Cy | op ) def = Collect(E | P | V ), Collect(E | P[x↔ y] | V ) def = Collect(E[y/x] | P | V [y/x]), Collect(E[x 7→ ( ~ xa).t] | [ ] | V ) def = Collect(E | [ ] | V [t/x]), Collect([ ] | [ ] | V ) def = remAnn(V ). Example 3.3.8 Let us consider the case for Example 2.1.9. First, we obtain rules in the machine as follows:  (Add(y1, S(w1)), S(Add(y2, w2)), [y1 ↔ y2][w1 ↔ w2]) (Add(y1, y2), Z, [y1 ↔ y2]). For the configuration 〈 r | Add(Z, r) = S(Z) 〉, we obtain the following initial machine state: ( [ ] | [r1 ↔ r2] | (Add(Z, r2), S(Z)) | r1 | − | delist ). The execution result is given below: ( [ ] [r1 ↔ r2] (Add(Z, r2), S(Z)) r1 − delist ) =⇒T.3 ( [ ] [r1 ↔ r2] − r1 − process(Add(Z, r2), S(Z)) ) =⇒I  [ ] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] − r1 − enlist  (( ).Z, y ′ 1), (r2, (w′ 1, ).S(w ′ 1)), (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2))   =⇒∗T.2=⇒T.3 [ ] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (( ).Z, y ′ 1), (r2, (w′ 1, ).S(w ′ 1)), (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − delist  47 =⇒T.1 [ ] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (r2, (w′ 1, ).S(w ′ 1)), (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − process(( ).Z, y′ 1)  =⇒III.0  [ ] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (r2, (w′ 1, ).S(w ′ 1)), (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − process(y′ 1, ( ).Z)  =⇒III.5 [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (r2, (w′ 1, ).S(w ′ 1)), (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − delist  =⇒T.1  [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − process(r2, (w′ 1, ) .S(w′ 1))  =⇒III.2  [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − process(r2, ( ,w′ 1) .S(w′ 1))  =⇒III.5  [r2 7→ (w′ 1, ).S(w 1)] [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (( ).Z, (y′ 2,w 2, ).Add(y ′ 2, w ′ 2)) r1 − delist  =⇒T.1 [r2 7→ (w′ 1, ).S(w 1)] [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] − r1 − process(( ).Z, (y′ 2,w ′ 2, ) .Add(y′ 2, w ′ 2))  =⇒I  [r2 7→ (w′ 1, ).S(w ′ 1)] [y′ 1 7→ ( ).Z] [y′′ 1 ↔ y′′ 2 ], [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] − r1 − enlist  (y′ 2, y′′ 1 ), (w′ 2, y ′′ 2 )   =⇒∗T.2=⇒T.3 [r2 7→ (w′ 1, ).S(w ′ 1)] [y′ 1 7→ ( ).Z] [y′′ 1 ↔ y′′ 2 ], [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (y′ 2, y ′′ 1 ), (w′ 2, y ′′ 2 ) r1 − delist  48 =⇒T.1  [r2 7→ (w′ 1, ).S(w ′ 1)] [y′ 1 7→ ( ).Z] [y′′ 1 ↔ y′′ 2 ], [y′ 1 ↔ y′ 2] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (w′ 2, y ′′ 2 ) r1 − process(y ′ 2, y ′′ 1 )  =⇒II.4  [r2 7→ (w′ 1, ).S(w 1)] [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′′ 2 ] [w′ 1 ↔ w′ 2] [r1 ↔ r2] (w′ 2, y ′′ 2 ) r1 − delist  =⇒T.1  [r2 7→ (w′ 1, ).S(w 1)] [y′ 1 7→ ( ).Z] [y′ 1 ↔ y′′ 2 ] [w′ 1 ↔ w′ 2] [r1 ↔ r2] − r1 − process(w′ 2, y′′ 2 )  =⇒II.4  [r2 7→ (w′ 1, ).S(w 1)] [y′ 1 7→ ( ).Z] [w′ 1 ↔ y′ 1] [r1 ↔ r2] − r1 − delist  . Finally, by using the operation Update, we obtain the computation result as follows: Update  [r2 7→ (w′ 1, ,).S(w 1)] [y′ 1 7→ ( ).Z] [w′ 1 ↔ y′ 1] [r1 ↔ r2] − r1 − delist  = Collect  [r2 7→ (y′ 1, ).S(y 1)] [y′ 1 7→ ( ).Z] [r1 ↔ r2] r1  = Collect  [r2 7→ (y′ 1, ).S(y 1)] [y′ 1 7→ ( ).Z] [ ] r2  = Collect ( [y′ 1 7→ ( ).Z] [ ] S(y ′ 1) ) = Collect ( [ ] [ ] S(Z) )

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An Implementation Model for Interaction Nets

To study implementations and optimisations of interaction net systems we propose a calculus to allow us to reason about nets, a concrete data-structure that is in close correspondence with the calculus, and a low-level language to create and manipulate this data structure. These work together so that we can describe the compilation process for interaction nets, reason about the behaviours of th...

متن کامل

A Calculus for Interaction Nets

Interaction nets are graphical rewriting systems which can be used as either a high-level programming paradigm or a low-level implementation language. However, an operational semantics together with notions of strategy and normal form which are essential to reason about implementations, are not easy to formalize in this graphical framework. The purpose of this paper is to study a textual calcul...

متن کامل

A rule-based evaluation of ladder logic diagram and timed petri nets for programmable logic controllers

This paper describes an evaluation through a case study by measuring a rule-based approach, which proposed for ladder logic diagrams and Petri nets. In the beginning, programmable logic controllers were widely designed by ladder logic diagrams. When complexity and functionality of manufacturing systems increases, developing their software is becoming more difficult. Thus, Petri nets as a high l...

متن کامل

Object-Oriented Petri nets Based Architecture Description Language for Multi-agent Systems

To narrow the gap between multi-agent formal modeling and multi-agent practical systems, multi-agent systems (MAS) are studied from the point of view of software architecture. As the existing architecture description languages (ADLs) are not suitable for describing the semantics of MAS, a novel architecture description language for MAS (ADLMAS) rooted in BDI model is proposed, which adopts Obje...

متن کامل

Interaction nets: programming language design and implementation

This paper presents a compiler for interaction nets, which, just like term rewriting systems, are user-definable rewrite systems which offer the ability to specify and program. In the same way that the λ -calculus is the foundation for functional programming, or horn clauses are the foundation for logic programming, we give in this paper an overview of a substantial software system that is curr...

متن کامل

Conversion of Petri Net Controllers for Manufacturing Systems into Ladder Logic Diagrams

W u d As automated manufacturing systems become more complex, the need for an effective design tool to p d u c e both high level Discrete Event Control System (DECS) and low level implementation, becomes increasingly more important Petri nets represent the most effective method for both the design and implementation of DECSs. The conversion of such Petri nets into ml-time applications has mnt l...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2015